package cn.edu.scau.cmi.dengzejun.chapter10;

import java.io.*;

public class Example6 {
	public static void main(String args[]) {
		File file = new File("Student.txt");
		String [] content = {"the stuff are","apple, 2 dollor/500g","banana,2.5 dollor/500g"};
		try {
			FileWriter outOne = new FileWriter(file);
			BufferedWriter outTwo = new BufferedWriter(outOne);
			for (String str:content) {
				outTwo.write(str);
				outTwo.newLine();
			}
			outTwo.close();
			outOne.close();
			FileReader inOne = new FileReader(file);
			BufferedReader inTwo = new BufferedReader(inOne);
			String s = null;
			while ((s = inTwo.readLine()) != null) {
				System.out.println(s);
			}
			inTwo.close();
			inOne.close();
		}catch(IOException e) {
			System.out.println(e);
		}
		return;
	}
}
